#include<iostream>
#include<cstring>
using namespace std;
const int N = 1e5 + 10; 
int w[N];
int f[N];
int n;
int gcd(int a, int b)
{
	return b ? gcd(b, a % b) : a;
}
int main()
{
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> w[i];
	}
	int d = w[1];
	for (int i = 2; i <= n; i++) {
		d = gcd(d, w[i]);
	}
	if (d != 1) {
		cout << "INF" << endl;
		return 0;
	}
	f[0] = 1;
	for (int i = 1; i <= n; i++) {
		for (int j = w[i]; j <= 1e4; j++) {
			f[j] |= f[j - w[i]];
		}
	}
	int ans = 0;
	for (int i = 1; i <= 1e4; i++) {
		ans += (1 - f[i]);
	}
	cout << ans << endl;
	return 0;
}